package com.example.demo.dao;

import com.example.demo.entity.BookInfo;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
//@Component
@Repository
public class BookDao {
    public List<BookInfo> mocData(){
        List<BookInfo> list = new ArrayList<BookInfo>();
        for(int i=1; i<=15; i++){
            BookInfo bookInfo = new BookInfo();
            bookInfo.setBookID(i);
            bookInfo.setBookName("图书"+i);
            bookInfo.setAuthor("作者"+i);
            bookInfo.setNum(new Random().nextInt(100));
            bookInfo.setPublish("出版社"+i);
            bookInfo.setStatus(i%5==0?2:1);
            bookInfo.setPrice(new BigDecimal(new Random().nextInt(100)));
            list.add(bookInfo);
        }
        return list;

    }
}
